import Request from '@/utils/request'
import Cookies from '@/utils/auth'

const state = () => ({
	
})
const getters = {
	
}
const mutations = {
	
}
const actions = {
	async get_trade_record({commit}, params) {  // 我的资产-收支明细
		return new Promise((resolve,reject)=>{
			Request.post('/api/account/queryAccounting',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
    async get_my_assets({commit}, params) {  // 我的资产
		return new Promise((resolve,reject)=>{
			Request.post('/api/account/queryMyAssets',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
    async get_ad_capital_manage({commit}, params) {  // 广告-资金管理
		return new Promise((resolve,reject)=>{
			Request.post('/api/account/queryAdAssets',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_ctg_income({commit}, params) {  // 分类收入总览
		return new Promise((resolve,reject)=>{
			Request.post('/api/account/queryMyAssetsAndInMain',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_ads_income({commit}, params) {  // 我的广告收入
		return new Promise((resolve,reject)=>{
			Request.post('/api/adPlace/getMyAdPlaceAwardIncomeStatistics',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_transaction_income({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/transaction/queryMyIncome',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_transaction_income_list({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/transaction/queryMyIncomeList',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_ad_income_list({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/adPlace/listPageMyAdPlaceIncome',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_other_income({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/redPacket/getMyIncome',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_other_income_list({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/redPacket/listPageMyIncomeItem',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_trade_income_chart({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/transaction/queryMyIncomeCurveList',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_ad_income_chart({commit}, walletAddress) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/adPlace/getMyAdPlaceMonthIncomeStatistics?walletAddress='+walletAddress)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_other_income_chart({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/redPacket/listMyIncomeCurve',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_trade_out({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/transaction/queryMyOut',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_trade_out_list({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/transaction/queryMyOutList',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_my_ad_out_list({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/adPlace/listPageMyAdPlaceAward',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
	async get_rank_trade({commit}, params) {  
		return new Promise((resolve,reject)=>{
			Request.post('/api/transaction/queryMyIncomeRankingList',params)
			.then(res=>{
				resolve(res.data) 
			})
		})
	},
}

export default {
	namespaced: true,
	state,
	getters,
	mutations,
	actions
}
